#ifndef TRANCEWIDGET_H
#define TRANCEWIDGET_H

#include <QWidget>
#include <QLabel>   //标签
#include <QPushButton>  //按钮
#include <QLineEdit>    //编辑框   ctrl+/注释
#include <QCalendarWidget>
#include <QComboBox>
#include <QMessageBox>
#include "model/usermodel.h"
#include <QCloseEvent>
#include <QComboBox>
#include <QListWidget>
#include "code/trancevideo.h"
#include <QDir>
#include <QFileInfoList>
#include <QFile>
#include <QFileDialog>
#include <QListWidget>
#include "model/videomodel.h"
#include <QHBoxLayout>
#include "model/configuremodel.h"
#include "model/logmodel.h"
#include <QProgressBar>
#include <QTimer>

class TranceWidget : public QWidget
{
    Q_OBJECT
public:
    TranceWidget(QWidget *parent = nullptr);
    ~TranceWidget();

    void init_window();
    void init_control();
    void init_connect();

private:
    QLabel *title, *inputDate, *format, *path;
    QLineEdit *pathEdit;
    QComboBox *formatbox;
    QPushButton *enterBtn, *backBtn, *choosePathBtn, *calendarBtn;
    QComboBox *box1;
    QCalendarWidget *calendar;
    QListWidget *listwidget;
    QListWidgetItem *listwidgetItem;
    TranceVideo *trancevideo;
    QFileDialog *folderPath;

    QString video_cover, tran_cover;

    QHBoxLayout *layout;

    QProgressBar *Bar;

    QTimer *timer;
    int x;

    // QWidget interface
protected:
    void closeEvent(QCloseEvent *event);

public slots:
    void showCalendar();
    void on_calendarWidget_selectionChanged();
    void chooseDir();
    void chooseVideo(QListWidgetItem* video);

    //转码的槽函数
    void doTrance();

    //每100毫秒发送一次信号
    void startProgress();

    void updateProgress();

signals:
    void backToMain();
};

#endif // TRANCEWIDGET_H
